package com.android.tea;

import java.util.ArrayList;
import java.util.List;

import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.Bitmap.Config;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.widget.ListView;

import com.android.tea.adapter.ChartAdapter;
import com.android.tea.entity.TeaFriend;
import com.android.tea.entity.TeaFriend.FriendType;

public class TeaFriendsChartActivity extends Activity {
    protected static final String TAG = "MainActivity";
	private ListView mListView;

	/** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.chart);

        initComponents();
    }

	private void initComponents() {
		mListView = (ListView)findViewById(R.id.listView1);
		mListView.setCacheColorHint(Color.TRANSPARENT);
		Bitmap bitmap = Bitmap.createBitmap(new int[] { 0xFFDEDEDE, 0xFFDEDEDE, 0xFFDEDEDE, 0xFFDEDEDE, 0xFFFFFFFF,
				0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF }, 2, 4, Config.RGB_565);
		mListView.setDivider(new BitmapDrawable(bitmap));
		mListView.setDividerHeight(2);

		ChartAdapter adapter = new ChartAdapter(this, loadData());
		mListView.setAdapter(adapter);
		
	}

	private List<TeaFriend> loadData() {
		List<TeaFriend> list = new ArrayList<TeaFriend>();
		TeaFriend member4 = new TeaFriend();
//		member.setAvatar(avatar);
		member4.setTitle("a");
		member4.setType(FriendType.Star_Friend);
		member4.setDesc("一起去shopping?");
		member4.setTimeStamp(System.currentTimeMillis());
		list.add(member4);
		
		TeaFriend member = new TeaFriend();
//		member.setAvatar(avatar);
		member.setTitle("爱相随");
		member.setDesc("谢谢你的反馈");
		member.setType(FriendType.Common_Friend);
		member.setTimeStamp(System.currentTimeMillis());
		list.add(member);
		
		TeaFriend member5 = new TeaFriend();
//		member.setAvatar(avatar);
		member5.setTitle("天上人间");
		member5.setType(FriendType.Common_Friend);
		member5.setDesc("一起来shopping?");
		member5.setTimeStamp(System.currentTimeMillis());
		list.add(member5);
		
		return list;
	}

	
}